import { isHidden } from "vant/lib/utils";
import { createRouter, createWebHashHistory } from "vue-router";
const defRoutes = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    name: "login",
    path: "/login",
    component: () => import("@/views/login/login.vue"),
  },
];
export const routes = [
  {
    path: "/homeCenter",
    name: "Home",
    meta: { title: "系统首页", icon: "icon-shouyediqiu" },
    children: [
      {
        path: "/homeCenter",
        component: () => import("@/views/home/index.vue"),
        name: "homeCenter",
        meta: { title: "数据统计", icon: "icon-tongjifenxi" },
      },
      {
        path: "/homeUser",
        component: () => import("@/views/home/user.vue"),
        name: "homeUser",
        meta: { title: "平台用户", icon: "icon-yonghu2" },
      },
    ],
  },
  {
    path: "/channel",
    name: "channel",
    meta: { title: "渠道管理", icon: "icon-shouyediqiu" },
    children: [
      {
        path: "/channel",
        component: () => import("@/views/channel/index.vue"),
        name: "channel",
        meta: { title: "渠道商", icon: "icon-yonghu2" },
      },
      {
        path: "/channelDetail",
        isHidden: true,
        component: () => import("@/views/channel/detail.vue"),
        name: "channelDetail",
        meta: { title: "渠道商详情", icon: "icon-yonghu2" },
      },
    ],
  },
  {
    path: "/authOrgin",
    name: "authOrgin",
    meta: { title: "授权管理", icon: "icon-shouyediqiu" },
    children: [
      {
        path: "/authOrgin",
        component: () => import("@/views/authOrgin/index.vue"),
        name: "authOrgin",
        meta: { title: "授权溯源", icon: "icon-yonghu2" },
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes: defRoutes.concat(routes),
});

export default router;
